package com.ruoyi.bellItem.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bellItem.domain.ClockItemSpecs;
import com.ruoyi.bellItem.service.IClockItemSpecsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 加钟服务项目规格Controller
 * 
 * @author ruoyi
 * @date 2025-04-07
 */
@RestController
@RequestMapping("/clockItemSpecs/clockItemSpecs")
public class ClockItemSpecsController extends BaseController
{
    @Autowired
    private IClockItemSpecsService clockItemSpecsService;

    /**
     * 查询加钟服务项目规格列表
     */
    @PreAuthorize("@ss.hasPermi('clockItemSpecs:clockItemSpecs:list')")
    @GetMapping("/list")
    public TableDataInfo list(ClockItemSpecs clockItemSpecs)
    {
        startPage();
        List<ClockItemSpecs> list = clockItemSpecsService.selectClockItemSpecsList(clockItemSpecs);
        return getDataTable(list);
    }

    /**
     * 导出加钟服务项目规格列表
     */
    @PreAuthorize("@ss.hasPermi('clockItemSpecs:clockItemSpecs:export')")
    @Log(title = "加钟服务项目规格", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ClockItemSpecs clockItemSpecs)
    {
        List<ClockItemSpecs> list = clockItemSpecsService.selectClockItemSpecsList(clockItemSpecs);
        ExcelUtil<ClockItemSpecs> util = new ExcelUtil<ClockItemSpecs>(ClockItemSpecs.class);
        util.exportExcel(response, list, "加钟服务项目规格数据");
    }

    /**
     * 获取加钟服务项目规格详细信息
     */
    @PreAuthorize("@ss.hasPermi('clockItemSpecs:clockItemSpecs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(clockItemSpecsService.selectClockItemSpecsById(id));
    }

    /**
     * 新增加钟服务项目规格
     */
    @PreAuthorize("@ss.hasPermi('clockItemSpecs:clockItemSpecs:add')")
    @Log(title = "加钟服务项目规格", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ClockItemSpecs clockItemSpecs)
    {
        return toAjax(clockItemSpecsService.insertClockItemSpecs(clockItemSpecs));
    }

    /**
     * 修改加钟服务项目规格
     */
    @PreAuthorize("@ss.hasPermi('clockItemSpecs:clockItemSpecs:edit')")
    @Log(title = "加钟服务项目规格", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ClockItemSpecs clockItemSpecs)
    {
        return toAjax(clockItemSpecsService.updateClockItemSpecs(clockItemSpecs));
    }

    /**
     * 删除加钟服务项目规格
     */
    @PreAuthorize("@ss.hasPermi('clockItemSpecs:clockItemSpecs:remove')")
    @Log(title = "加钟服务项目规格", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(clockItemSpecsService.deleteClockItemSpecsByIds(ids));
    }
}
